import request from '@/utils/request'

// 创建生产排班
export function createSchedule(data) {
  return request({
    url: '/lamp/schedule/create',
    method: 'post',
    data: data
  })
}

// 更新生产排班
export function updateSchedule(data) {
  return request({
    url: '/lamp/schedule/update',
    method: 'put',
    data: data
  })
}

// 删除生产排班
export function deleteSchedule(id) {
  return request({
    url: '/lamp/schedule/delete?id=' + id,
    method: 'delete'
  })
}

/** 批量删除生产排班 */
export function deleteScheduleList(ids) {
  return request({
    url: `/lamp/schedule/delete-list?ids=${ids.join(',')}`,
    method: 'delete'
  })
}

// 获得生产排班
export function getSchedule(id) {
  return request({
    url: '/lamp/schedule/get?id=' + id,
    method: 'get'
  })
}

// 获得生产排班分页
export function getSchedulePage(params) {
  return request({
    url: '/lamp/schedule/page',
    method: 'get',
    params
  })
}
// 导出生产排班 Excel
export function exportScheduleExcel(params) {
  return request({
    url: '/lamp/schedule/export-excel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}